//
//  cardtest1.c
//  Dominion
//
//  Eric Hook
//  hooke@onid.orst.edu
//  CS362 Winter 2014
//

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

int seed = 1000;
int k[10] = {adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall};

void testCardEffectVerifySmithyAdd3CardsToHandAndSub3FromDeck() {
    int result = 0;
    int card = smithy;
    int bonus = 0;
    struct gameState G;
    int currentPlayer = 0;
    int beforeDeckCount = 0;
    int beforeHandCount = 0;
    int afterDeckCount = 0;
    int afterHandCount = 0;
    
    printf ("TESTING: int cardEffect(int card, int choice1, int choice2, int choice3, struct gameState *state, int handPos, int *bonus) : Smithy : cardTest2.c.\n");
    
    memset(&G, 23, sizeof(struct gameState));       // clear the game state
    result = initializeGame(2, k, seed, &G);
    assert(result == 0);                            // validate that the game was inititalized correctly
    
    beforeDeckCount = G.deckCount[currentPlayer];
    beforeHandCount = G.handCount[currentPlayer];
    
    printf("beforeDeckCount = %d, beforeHandCount %d\n", beforeDeckCount, beforeHandCount);
    
    cardEffect(card, 1, 1, 1, &G, 1, &bonus);
    
    afterDeckCount = G.deckCount[currentPlayer];    // deck should have 3 less cards
    afterHandCount = G.handCount[currentPlayer];    // hand should have 2 more cards (3 new MINUS played Smithy card)
    
    printf("afterDeckCount  (deck should have 3 less cards) = %d\nafterHandCount hand should have 2 more cards (3 new MINUS played Smithy card): %d\n", afterDeckCount, afterHandCount);
    
    assert( beforeDeckCount == (afterDeckCount + 3));
    assert( beforeHandCount == (afterHandCount - 2));
    
    printf ("!!! PASS: int cardEffect(int card, int choice1, int choice2, int choice3, struct gameState *state, int handPos, int *bonus) : Smithy : cardTest2.c.\n");
}

int main () {
    testCardEffectVerifySmithyAdd3CardsToHandAndSub3FromDeck();
    return 0;
}